<template>
  <div class="backBtn" @click="router.back()">返回</div>
</template>

<script lang="ts">
import { defineComponent } from "vue";
import { useRouter } from "vue-router";

export default defineComponent({
  setup() {
    const router = useRouter();

    return { router };
  },
});
</script>

<style scoped>

.backBtn {
  vertical-align: top;
  margin: 20px;
  display: inline-block;
  text-align: center;
  width: 160px;
  height: 44px;
  line-height: 44px;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  line-height: 44px;
  color: #2194e0;
  border: 1px solid #2194e0;
  transition: all 0.2s ease-in-out;
  position: relative;
  opacity: 1;
  overflow: hidden;
}

.backBtn:before {
  content: "";
  background-color: rgba(255, 255, 255, 0.5);
  height: 100%;
  width: 3em;
  display: block;
  position: absolute;
  top: 0;
  left: -4.5em;
  transform: skewX(-45deg) translateX(0);
  transition: none;
}

.backBtn:hover {
  background-color: #2194e0;
  color: #fff;
}

.backBtn:hover:before {
  transform: skewX(-45deg) translateX(260px);
  transition: all 0.5s ease-in-out;
}

.backBtn:active {
  opacity: 0.8;
}
</style>
